package com.secret.chain.secretchain.controller.wx;

import com.secret.chain.secretchain.domain.entity.Collect;
import com.secret.chain.secretchain.result.Result;
import com.secret.chain.secretchain.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("wx/collect")
@CrossOrigin
public class CollectController {
    @Autowired
    private CollectService collectService;

    @GetMapping("{userId}")
    public Result queryByUserId(@PathVariable Integer id){
        Result result = collectService.queryByUserId(id);
        return result;
    }

    @PostMapping
    public Result save(@RequestBody Collect collect){
        return collectService.save(collect);
    }

    @DeleteMapping
    public Result delete(Integer id){
        return collectService.delete(id);
    }
}
